import  requests
import time
import lxml
from  bs4 import BeautifulSoup

header= {'User-Agent':'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.84 Safari/537.36'}

def  get_info(url):

    wb_data=requests.get(url,header)
    soup=BeautifulSoup(wb_data.text,'lxml')
    ranks=soup.select('span.pc_temp_num')
    titles=soup.select('div.pc_temp_songlist > ul > li > a')
    times=soup.select('span.pc_temp_tips_r > span')
    for rank,title,time in zip(ranks,titles,times):
        data={'rank':rank.get_text().strip(),
              'title':title.get_text().strip(),
              'time':time.get_text().strip()
              }
        print(data);


urls=['http://www.kugou.com/yy/rank/home/{}-8888.html'.format(str(i)) for i in range(1,24)]
for url in urls:
    get_info(url)

#print(get_info('http://www.kugou.com/yy/rank/home/1-8888.html'))